#ifndef PROTOTYPES_H
#define PROTOTYPES_H

/*
 This file is used to prototype all functions so that they are 
 allowed to be called before the actual functions i declared.
 */

#ifdef _WIN32
#define OS_OBJ_PATH(s) "data\\objects\\" #s
#define OS_FONT_PATH(s) "data\\fontMaps\\" #s
#define OS_IMG_PATH(s) "data\\images\\" #s
#define OS_SETTINGS_PATH(s) #s
#define OS_SHADER_PATH(s) "data\\shaders\\" #s
#else
#define OS_OBJ_PATH(s) #s
#define OS_FONT_PATH(s) #s
#define OS_IMG_PATH(s) #s
#define OS_SETTINGS_PATH(s) "." #s
#define OS_SHADER_PATH(s) #s
#endif

/*
 * stuff
 */
#define PLAYER_RESPAWN_TIME 300
#define WEAPON_NONE 0
#define WEAPON_CANNON 1
#define WEAPON_RAILGUN 2
#define WEAPON_MINE 3
#define WEAPON_SWIRLBOMB 4

char weaponNamesArray[5][30];

#define OBJECT_PASS_THROUGH 0
#define OBJECT_BUMP 1
#define OBJECT_IMMOVABLE 2
#define OBJECT_DISABLED 3

#define COLLISIONOBJECT_ARRAY_MAX 300
CollisionObject *collisionObjectArray[COLLISIONOBJECT_ARRAY_MAX];
#define BULLET_ARRAY_MAX 200
Bullet *bulletArray[BULLET_ARRAY_MAX];
#define MODEL_ARRAY_MAX 100
ObjectMesh *modelArray[MODEL_ARRAY_MAX];
#define TEXTURE_ARRAY_MAX 100
int textureArray[TEXTURE_ARRAY_MAX];

// check if a game is currently running
int gamePlaying = GL_FALSE;

// shaders
GLhandleARB waterShader;
GLhandleARB stegu1;
GLhandleARB stegu2;
GLhandleARB stegu3;
GLhandleARB stegu4;
int ProjectionModelviewMatrix_Loc[2];

// renderObjects.h
void initObjectArray(Vertex **varray, int **iarray, char filename[], int *vsize, int *isize, float scale, XYZ rotation);
void addMeshTexture(ObjectMesh *obj, char texture[100]);
void initObjectMesh(ObjectMesh *obj, char filename[100], float scale, XYZ rotation);
void drawObjectDirectRendering(PlayerObject *obj);
void drawMeshVBO(ObjectMesh *obj);
void drawPlayerVBO(PlayerObject *obj);
void drawStaticObject(StaticObject *obj);
void drawBullet(Bullet *theBullet);
void drawCollisionObject(CollisionObject *obj);
void objectRadius(ObjectMesh *obj);
void maxmin(ObjectMesh *obj);

// renderObjectEffects.h
void drawObjectExploding(PlayerObject *obj, GLfloat amount, GLfloat boost);
void drawObjectSinking(PlayerObject *obj, GLfloat amount);
void drawObjectWhirlpool(PlayerObject *obj, GLfloat amount, float boost, int time);
void spawnPlayer(PlayerObject *player);

// renderText.h
void initTextFonts();
void textMessageAdd(char msg[]);
void printMessages();
void printTextOnScreen(int xPos, int yPos, int fontSize, char msg[], Color theColor);

// playerManagement.h
void initPlayerObject(PlayerObject *obj, char filename[100], char name[20], float mass, float scale, XYZ rotation);
void allocatePartMemory(PlayerObject *obj, int number);
void addStaticObject(PlayerObject *obj, char filename[100], Location pos, float angle, float scale, XYZ rotation);
void initStaticObject(StaticObject *obj, char filename[100], Location pos, float angle, float scale, XYZ rotation);
void spawnPlayer(PlayerObject *player);
void playerKilled(PlayerObject *killer, PlayerObject *pray, int killAnimation);

// playerManagementCollision.h
void boundingSphere(PlayerObject *obj1, PlayerObject *obj2);
int checkCollision(float r1, Location pos1, XYZ center1, float r2, Location pos2, XYZ center2);

// objectManagement.h
int addCollisionObject(char identity[], int model, int texture, Location pos, XYZ angle, float mass, int collide, void (*f)(PlayerObject*,CollisionObject*), void (*animate)(CollisionObject*), GLhandleARB shader);
void initCollisionObjects();
void bumpCheck(PlayerObject *player, CollisionObject *obj);
void bumpCheckObjects(CollisionObject *obj1, CollisionObject *obj2);
void initArrays();
int addBullet(PlayerObject *player, int model, int texture, int damage, int killAnimation, void (*animation)(Bullet*), Location pos, XYZ velocity, XYZ angle);
int removeBullet(Bullet *theBullet);
int addModel(char filename[100], float scale, XYZ rotation);
int removeModel(ObjectMesh *theModel);
int addTexture(char filename[100]);

// objectManagementPopulation.h
void playerInitialization(PlayerObject *player1, PlayerObject *player2);
void modelArrayPopulation();
void objectPopulation();
void addCollisionObjectBoxes();

// objectManagementCollision.h
void player_whirlpool(PlayerObject *player,CollisionObject *obj);
void player_sink(PlayerObject *player,CollisionObject *obj);
void player_explode(PlayerObject *player,CollisionObject *obj);
void object_switcher(PlayerObject *player,CollisionObject *obj);
void powerup_lifebox(PlayerObject *player,CollisionObject *obj);

// objectManagementAnimation.h
void object_hover_rotate(CollisionObject *obj);
void object_buoy(CollisionObject *obj);
void object_eight(CollisionObject *obj);
void object_water(CollisionObject *obj);
void bullet_bouy(Bullet *obj);
void powerup_cannon(PlayerObject *player,CollisionObject *obj);
void powerup_mine(PlayerObject *player,CollisionObject *obj);
void powerup_swirlbomb(PlayerObject *player,CollisionObject *obj);


// menuManagement.h
void renderMenu(int activeMenuItem, int menuItemsCount, char* menuItems[]);
void menuInteractions(int activeMenuItem, int menuItemsCount);
void renderMenuItemContent(int activeMenuItem);
void renderMenuBackground();
#endif